function s = subsasgn(s,index,val)
% SUBSASGN Define index assignment for lpcvd_2DSurface objects
switch index.type
    case '()'
        error('Not supported');
    case '.'
        switch index.subs
            case 'h'
                s.h = val;
            case 'x'
                s.x = val;
            case 'y'
                s.y  = val;
            case 'site_width'
				site_width_old = s.site_width;
				s.x = s.x/site_width_old*val;
				s.y = s.y/site_width_old*val;
				s.site_width = val;
            case 'site_width_unit'
                s.site_width_unit = val;
            case 'layer_thickness'
                s.layer_thickness = val;
			case 'layer_thickness_unit'
				s.layer_thickness_unit = val;
            otherwise
                error('Undefined field');
        end
end